package game.action.actions.message;

import game.action.BaseAction;
import game.system.UserModel;
import game.system.UserVo;

public class MessageAction extends BaseAction {
	private String uid;
	private String message;
	@Override
	public void execute() {
		UserVo user = UserModel.getUser(uid);
		if(user==null){
			this.getGameThread().send("messageAction?return=error&error=not_user");
		}else{
			this.getGameThread().send("messageAction?return=success");
			user.send("messageAction?message="+message);
		}
	}

	@Override
	public String initParams() {
		this.uid = this.getParams().get("uid").toString();
		this.message = this.getParams().get("message").toString();
		return null;
	}

	@Override
	public boolean validate() {
		return true;
	}

}
